package com.sudichina.sudichina.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;


import com.sudichina.sudichina.view.fragment.BaseFragemnt;

import java.util.ArrayList;
import java.util.List;

/**
 * Name: OrlderAdapter
 * Action:
 * Author: liuan
 * creatTime:2017-03-08 13:29
 */
public class OrlderAdapter extends FragmentPagerAdapter {
    //fragment列表
    private List<BaseFragemnt> list_fragment;


    public OrlderAdapter(FragmentManager supportFragmentManager, ArrayList<BaseFragemnt> list_fragment) {
        super(supportFragmentManager);
        this.list_fragment = list_fragment;
    }


    @Override
    public Fragment getItem(int position) {
        return list_fragment.get(position);
    }


    @Override
    public int getCount() {
        return list_fragment.size();
    }
    //此方法 用来显示tab上的名字

    @Override
    public CharSequence getPageTitle(int position) {
        return list_fragment.get((position % list_fragment.size())).getTitle();
    }
}
